<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 120, 11, 12, 13, 14, 24, 16, 16, 21, 18]
        let num1 = []
        for (let i = 0; i < num.length; i++) {
            if (num[i] % 3 == 0) {
                num1.push(num[i])
            }
        }
        console.log(num1);
    </script>
</body>

</html>